package com.bdgj.action;

import java.util.List;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;

import org.springframework.http.HttpRequest;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import com.bdgj.bean.UserInfoBean;
import com.bdgj.service.UserInfoService;

@Controller
public class UserInfoAction {
	
	@Resource
	private UserInfoService userS;
	
	@Resource
	private HttpServletRequest request;
	
	@RequestMapping("/doUserLogin")
	public String doUserLogin(UserInfoBean userB) {
		String str = "../../login";
		List<UserInfoBean> ulst = userS.selectLoginUser(userB);
		UserInfoBean ubean = ulst.get(0);
		request.getSession().setAttribute("ubean", ubean);
		if (ulst != null && ulst.size() > 0) {
			str = "main/usermain";
		}
		return str;
		
	}
}
